package com.hzspace.aop.service;

import org.springframework.stereotype.Service;

/**
 * @Author: LiuHao
 * @Descirption:
 * @Date: 2020/3/1_23:07
 */
@Service
public class UserService {

    /**
     * doAround Proceed Method Nameinsert
     * doBefore==>insert
     * Insert....
     * doAfter==>insert
     * doAfterReturning==>insert, Return===>Insert
     * 执行顺序 doAround() doBefore() insert() doAfter() doAfterReturning()
     * @return
     */
    public Object insert(){
        System.out.println("Insert....");
        return "Insert";
    }

    /**
     * doAround Proceed Method Namedelete
     * doBefore==>delete
     * Delete....
     * doAfter==>delete
     * doAfterReturning==>delete, Return===>null
     * 执行顺序 doAround() doBefore() delete() doAfter() doAfterReturning()
     */
    public void delete(){
        System.out.println("Delete....");
    }

    /**
     * doAround Proceed Method Nameupdate
     * doBefore==>update
     * Update...
     * doAfter==>update
     * doAfterThrowing==>update, Exception Message===>null
     * 执行顺序 doAround() doBefore() update() doAfter() doAfterThrowing()
     * @return
     */
    public Object update(){
        System.out.println("Update...");
        throw new RuntimeException();
    }

    /**
     * doAround doesn't Proceed Method Namefind
     * doAfter==>find
     * doAfterReturning==>find, Return===>null
     * 执行顺序 doAround() 被拦截 doAfter() doAfterReturning()
     */
    public void find(){
        System.out.println("Find...");
    }
}
